package com.big.app.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.big.app.dao.DianZanDao;
import com.big.app.entity.DianZan;
import com.big.app.service.intf.DianZanService;
import com.big.app.vo1.R;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DianZanImpl implements DianZanService {
    @Resource
    private DianZanDao dao;
    @Override
    public R all() {
        return new R(200,"ok",dao.selectList(new QueryWrapper<DianZan>().eq("dzusers",123)));
    }

    @Override
    public R insert(DianZan dianZan) {

        dianZan.setDzusers("123");
        int i = dao.insert(dianZan);
        if (i==1){
            return new R(200,"ok",null);
        }else {
            return new R(400,"false",null);
        }
    }

    @Override
    public R delete(DianZan dianZan) {
        int i = dao.deleteById(dianZan);

        if (i==1){
            return new R(200,"ok",null);
        }else {
            return new R(400,"false",null);
        }
    }
}
